also plase check this JDBC Connection to reset not identical to originally prepared Connection - please make sure to use connection release mode ON_CLOSE (the default) and to run against Hibernate 4.2+ (or switch HibernateJpaDialect's prepareConnection flag to false
Invocation of init method failed; nested exception is org.hibernate.AnnotationException: referencedColumnNames(country_id, np_version) of hkjc.cap.ida.fb.ob.entity.profile.CountryName.country referencing hkjc.cap.ida.fb.ob.entity.profile.Country not mapped to a single propertyorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalEntityManagerFactory' defined in class path resource [hkjc/cap/ida/fb/outbound/ps/configure/DatabaseConfig.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: referencedColumnNames(country_id, np_version) of hkjc.cap.ida.fb.ob.entity.profile.CountryName.country referencing hkjc.cap.ida.fb.ob.entity.profile.Country not mapped to a single property
需要在父类添加@MappedSuperclass
//org.hibernate.cfg.BinderHelper#findPropertiesByColumns
while ( it.hasNext() ) {
matchColumnsByProperty( (Property) it.next(), columnsToProperty );
}
if ( isPersistentClass ) {
matchColumnsByProperty( ( (PersistentClass) columnOwner ).getIdentifierProperty(), columnsToProperty );
}
//first naive implementation
//only check 1 columns properties
//TODO make it smarter by checking correctly ordered multi column properties
List<Property> orderedProperties = new ArrayList<>();
for (Column column : orderedColumns) {
boolean found = false;
for (Property property : columnsToProperty.get( column ) ) {
if ( property.getColumnSpan() == 1 ) {
orderedProperties.add( property );
found = true;
break;
}
}
if ( !found ) {
//have to find it the hard way
return null;
}
}